<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <button class="add">增加</button>
</body>

<script>
    var add = document.getElementsByClassName('add')[0]



    add.onclick = function () {
        var date = new Date();
        date.setSeconds(date.getSeconds() + 30 * 60);

        // console.log(date.toString());  // 日期对象转字符串(中国标准时间)
        // console.log(date.toUTCString());  // 日期对象转字符串(世界时)


        document.cookie = "user=a123123; expires=" + date.toUTCString();
        document.cookie = "pwd=123123; expires=" + date.toUTCString();
        document.cookie = "phone=17386141517; expires=" + date.toUTCString();
        document.cookie = "email=123123@qq.com; expires=" + date.toUTCString();
    }

</script>

</html>